<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<jsp:include page="/admin/jsp/common/HtmlHead.jsp"/>
	<title>Insert title here</title>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.validate.min.js"></script>
	<script type="text/javascript">
	$(function(){
		<s:if test="admin.id>0">
		$("form").validate({
			rules:{
				'admin.realName':{
					required:true,
					maxlength:200
				}
			},
			messages:{
				'admin.realName':{
					required:'请输入真实姓名',
					maxlength:'请输入小于{0}个字符'
				}
			}
		});
		</s:if><s:else>
		$("form").validate({
			rules:{
				'admin.loginName':{
					required:true,
					maxlength:200
				},
				'admin.pwd':{
					required:true,
					minlength:6,
					maxlength:32
				},
				'admin.realName':{
					required:true,
					maxlength:200
				}
			},
			messages:{
				'admin.loginName':{
					required:'请输入登录名',
					maxlength:'请输入小于{0}个字符'
				},
				'admin.pwd':{
					required:'请输入密码',
					maxlength:'请输入小于{0}个字符',
					minlength:'请输入小于{0}个字符'
				},
				'admin.realName':{
					required:'请输入真实姓名',
					maxlength:'请输入小于{0}个字符'
				}
			}
		});
		</s:else>
	});
	</script>
</head>
<body>
	<div id="page_main">
		<div class="top_bar">
			<span class="sta_pos">当前位置：</span><span>系统管理</span>
			&gt;
			<s:if test="admin.id>0">
			<span>编辑管理员</span>
			</s:if><s:else>
			<span>添加管理员</span>
			</s:else>
		</div>
		<div class="edit_ctn">
			<s:form action="editDo" method="post">
				<s:hidden name="admin.id"/>
				<table style="width:100%;" border="0" class="edit_tab" cellpadding="0" cellspacing="0">
					<tr>
						<th style="width:25%;">
							<s:if test="admin==null||admin.id==0">
							<span class="error">*</span>&nbsp;
							</s:if>
							登录名
						</th>
						<td style="width:75%;">
							<s:if test="admin.id>0">
								<s:textfield name="admin.loginName" disabled="true" cssClass="txt"/>
							</s:if>
							<s:else>
								<s:textfield name="admin.loginName" cssClass="txt"/>
							</s:else>
						</td>
					</tr>
					<tr>
						<th>
						<s:if test="admin==null||admin.id==0">
						<span class="error">*</span>&nbsp;
						</s:if>
						密码</th>
						<td>
							<input type="password" name="admin.pwd" class="txt"/>
							<s:if test="admin.id>0">
							<p style="color:#6699ff;">(不输入不会修改用户现有密码)</p>
							</s:if>
						</td>
					</tr>
					<tr>
						<th><span class="error">*</span>&nbsp;真实姓名</th>
						<td>
							<s:textfield name="admin.realName" maxlength="200" cssClass="txt"/>
						</td>
					</tr>
					<tr>
						<td style="border-right: none;">&nbsp;</td>
						<td>
							<a class="btn" href="javascript:document.getElementById('btn_submit').click()"><span>提交</span></a>
							<a class="btn" href="javascript:window.history.go(-1);" style="margin-left:24px;"><span>返回</span></a>
							<input type="submit" value="提交" style="display:none;" id="btn_submit"/>
						</td>
					</tr>
				</table>
			</s:form>
		</div>
	</div>
</body>
<jsp:include page="/admin/jsp/common/errorMessage.jsp"/>
</html>